EMTool
Class EMText

java.lang.Object
  extended by EMTool.EMText
All Implemented Interfaces:
EMInterface

public class EMText
extends java.lang.Object
implements EMInterface


Field Summary
(package private)  java.lang.String serverIP
           
(package private)  java.lang.String serverpassword
           
(package private)  java.lang.String serverusername
           
(package private)  java.lang.String username
           
 
Fields inherited from interface EMTool.EMInterface
DEVICEDOESNOTEXIST, FAILURE, NODEVICESFOUND, NOUSERSFOUND, SUCCESS, USERDOESNOTEXIST
 
Constructor Summary
EMText()
           
 
Method Summary
private  java.lang.String generateXML(java.lang.String sRequestType, java.lang.String sRequest, java.lang.String sDeviceName, java.lang.String sDeviceProfile, java.lang.String duration)
          Generate XML Request as a String.
 void init(java.lang.String serverIP, java.lang.String serverUser, java.lang.String serverPassword)
           
 java.lang.String login(java.lang.String deviceName, java.lang.String username, java.lang.String deviceProfile, java.lang.String duration)
          Login the user into the device with the specificed profile
 java.lang.String logout(java.lang.String deviceName)
          Logout any user that is currently logged into the device
private  java.lang.String parseXML(java.lang.String xmlResponse)
          This parses the XML Resonse as a String.
 java.lang.String queryDevice(java.lang.String username)
          Get the device name if any of the device the user is currently logged in to
 java.lang.String queryUser(java.lang.String deviceName)
          Get the username if any of the user currently logged in to the specified device
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverIP

java.lang.String serverIP

serverusername

java.lang.String serverusername

serverpassword

java.lang.String serverpassword

username

java.lang.String username
Constructor Detail

EMText

public EMText()
Method Detail

login

public java.lang.String login(java.lang.String deviceName,
                              java.lang.String username,
                              java.lang.String deviceProfile,
                              java.lang.String duration)
Description copied from interface: EMInterface
Login the user into the device with the specificed profile

Specified by:
login in interface EMInterface
Parameters:
deviceName - Device name of device to login to
username - User to log in
deviceProfile - Device profile to use
duration - null for infinite or number of minutes to remain logged in
Returns:
Text indicating success or failure of the action

logout

public java.lang.String logout(java.lang.String deviceName)
Description copied from interface: EMInterface
Logout any user that is currently logged into the device

Specified by:
logout in interface EMInterface
Parameters:
deviceName - Device name of device to logout of
Returns:
Text indicating success or failure of the action

queryUser

public java.lang.String queryUser(java.lang.String deviceName)
Description copied from interface: EMInterface
Get the username if any of the user currently logged in to the specified device

Specified by:
queryUser in interface EMInterface
Returns:
Username currently associated with device or failure text

queryDevice

public java.lang.String queryDevice(java.lang.String username)
Description copied from interface: EMInterface
Get the device name if any of the device the user is currently logged in to

Specified by:
queryDevice in interface EMInterface
Returns:
Devicename currently associated with user or failure text

generateXML

private java.lang.String generateXML(java.lang.String sRequestType,
                                     java.lang.String sRequest,
                                     java.lang.String sDeviceName,
                                     java.lang.String sDeviceProfile,
                                     java.lang.String duration)
Generate XML Request as a String. No helper classes are used, the XML is built by combining the XML tags and the parameters provided. This method is used to generate the login, logout, userDeviceQuery and deviceUserQuery messages

Parameters:
sRequestType - "login/logout" for login or logout, any other value for query.
sRequest - login, logout, device or user depending on the value of sRequestType
sDeviceName - Device name used by login, logout and deviceUserQuery
sDeviceProfile - Device profile name used by login
duration - Number of seconds or indefinite, used by login
Returns:
Generated XML

parseXML

private java.lang.String parseXML(java.lang.String xmlResponse)
This parses the XML Resonse as a String. This method uses a brute force approach to spliting and parsing the response. No helper classes are used.

Parameters:
xmlResponse - Either EMInterface.SUCCESS, EMInterface.NODEVICESFOUND or EMInterface.FAILURE plus the text of the error.
Returns:
Return success or failure message

init

public void init(java.lang.String serverIP,
                 java.lang.String serverUser,
                 java.lang.String serverPassword)
Specified by:
init in interface EMInterface
Parameters:
serverIP - This is the IP address of the server running the EM Services
serverUser - Username of a user with that can execute EM command via the EMServices interface This user must either be the user assigned to the device on which the operation is performed, or a user with the "Standard EM Autheticatio Proxy Rights" role. This parameter is used as the AppID in the AppInfo object
serverPassword - Password for the server USer. This parameter is used as the AppCertificate in the AppInfo object